offers content that covers every aspect of real estate investing from analyzing deals, how to find & finance properties, tips & advice
Having made a name for himself as a major real estate YouTuber,
nique approach to teaching real estate investing has helped his mentees achieve financial success
began his career as a real estate agent at the age of 18 and became a billionaire by the age of 26. His videos are based on his own early
is a real estate hustler, fitness enthusiast, spontaneous adventurer. Loida's channel will provide you with real estate tips/advice on the daily .
# lets import libraries
from googleapiclient.discovery import build
import pandas as pd
import seaborn as sns
api_key = 'AIzaSyB24Kop04L1GlTgRCm1XtQ4KB2a4gaBOwA'
BiggerPockets_channel_id = ['UCVWDbXqQ8cupuVpotWNt2eg' # BiggerPockets
]
youtube = build('youtube','v3',developerKey = api_key)
from googleapiclient.errors import HttpError
def get_channel_stats(youtube, BiggerPockets_channel_id):
all_data = []
try:
request = youtube.channels().list(
part='snippet,contentDetails,statistics',
id=','.join(BiggerPockets_channel_id)
)
response = request.execute()
for item in response.get('items', []):
snippet = item.get('snippet', {})
statistics = item.get('statistics', {})
data = {
'Channel_name': snippet.get('title', ''),
'Subscribers': statistics.get('subscriberCount', ''),
'Views': statistics.get('viewCount', ''),
'Total_videos': statistics.get('videoCount', '')
}
all_data.append(data)
except HttpError as e:
print(f"HTTP error occurred: {e}")
print(f"Request URL: {e.resp.request.url}")
print(f"Request body: {e.resp.request.body}")
return all_data
get_channel_stats(youtube, BiggerPockets_channel_id)
[{'Channel_name': 'BiggerPockets', 'Subscribers': '1160000', 'Views': '104779284', 'Total_videos': '3092'}]
channel_statistics = get_channel_stats(youtube, BiggerPockets_channel_id)
BiggerPockets_channel_data =pd.DataFrame(channel_statistics)
BiggerPockets_channel_data
Channel_name | Subscribers | Views | Total_videos | |
---|---|---|---|---|
0 | BiggerPockets | 1160000 | 104779284 | 3092 |
api_key = 'AIzaSyB24Kop04L1GlTgRCm1XtQ4KB2a4gaBOwA'
Grant_Cardone_channel_id = ['UCdlNK1xcy-Sn8liq7feNxWw' # Grant Cardone
]
youtube = build('youtube','v3',developerKey = api_key)
from googleapiclient.errors import HttpError
def get_channel_stats(youtube, Grant_Cardone_channel_id):
all_data = []
try:
request = youtube.channels().list(
part='snippet,contentDetails,statistics',
id=','.join(Grant_Cardone_channel_id)
)
response = request.execute()
for item in response.get('items', []):
snippet = item.get('snippet', {})
statistics = item.get('statistics', {})
data = {
'Channel_name': snippet.get('title', ''),
'Subscribers': statistics.get('subscriberCount', ''),
'Views': statistics.get('viewCount', ''),
'Total_videos': statistics.get('videoCount', '')
}
all_data.append(data)
except HttpError as e:
print(f"HTTP error occurred: {e}")
print(f"Request URL: {e.resp.request.url}")
print(f"Request body: {e.resp.request.body}")
return all_data
get_channel_stats(youtube, Grant_Cardone_channel_id)
[{'Channel_name': 'Grant Cardone', 'Subscribers': '2510000', 'Views': '522294867', 'Total_videos': '5944'}]
channel_statistics = get_channel_stats(youtube, Grant_Cardone_channel_id)
Grant_Cardone_channel_data =pd.DataFrame(channel_statistics)
Grant_Cardone_channel_data
Channel_name | Subscribers | Views | Total_videos | |
---|---|---|---|---|
0 | Grant Cardone | 2510000 | 522294867 | 5944 |
api_key = 'AIzaSyB24Kop04L1GlTgRCm1XtQ4KB2a4gaBOwA'
Phil_Pustejovsky_channel_id = ['UC0u4GWBzgYQxM_Rg8npQchg' # Phil Pustejovsky
]
youtube = build('youtube','v3',developerKey = api_key)
from googleapiclient.errors import HttpError
def get_channel_stats(youtube, Phil_Pustejovsky_channel_id):
all_data = []
try:
request = youtube.channels().list(
part='snippet,contentDetails,statistics',
id=','.join(Phil_Pustejovsky_channel_id)
)
response = request.execute()
for item in response.get('items', []):
snippet = item.get('snippet', {})
statistics = item.get('statistics', {})
data = {
'Channel_name': snippet.get('title', ''),
'Subscribers': statistics.get('subscriberCount', ''),
'Views': statistics.get('viewCount', ''),
'Total_videos': statistics.get('videoCount', '')
}
all_data.append(data)
except HttpError as e:
print(f"HTTP error occurred: {e}")
print(f"Request URL: {e.resp.request.url}")
print(f"Request body: {e.resp.request.body}")
return all_data
get_channel_stats(youtube, Phil_Pustejovsky_channel_id)
[{'Channel_name': 'Phil Pustejovsky', 'Subscribers': '330000', 'Views': '118822902', 'Total_videos': '286'}]
channel_statistics = get_channel_stats(youtube, Phil_Pustejovsky_channel_id)
Phil_Pustejovsky_channel_data =pd.DataFrame(channel_statistics)
Phil_Pustejovsky_channel_data
Channel_name | Subscribers | Views | Total_videos | |
---|---|---|---|---|
0 | Phil Pustejovsky | 330000 | 118822902 | 286 |
api_key = 'AIzaSyB24Kop04L1GlTgRCm1XtQ4KB2a4gaBOwA'
Graham_Stephan_channel_id = ['UCV6KDgJskWaEckne5aPA0aQ' # Graham Stephan
]
youtube = build('youtube','v3',developerKey = api_key)
from googleapiclient.errors import HttpError
def get_channel_stats(youtube, Graham_Stephan_channel_id):
all_data = []
try:
request = youtube.channels().list(
part='snippet,contentDetails,statistics',
id=','.join(Graham_Stephan_channel_id)
)
response = request.execute()
for item in response.get('items', []):
snippet = item.get('snippet', {})
statistics = item.get('statistics', {})
data = {
'Channel_name': snippet.get('title', ''),
'Subscribers': statistics.get('subscriberCount', ''),
'Views': statistics.get('viewCount', ''),
'Total_videos': statistics.get('videoCount', '')
}
all_data.append(data)
except HttpError as e:
print(f"HTTP error occurred: {e}")
print(f"Request URL: {e.resp.request.url}")
print(f"Request body: {e.resp.request.body}")
return all_data
get_channel_stats(youtube,Graham_Stephan_channel_id)
[{'Channel_name': 'Graham Stephan', 'Subscribers': '4610000', 'Views': '818870610', 'Total_videos': '984'}]
channel_statistics = get_channel_stats(youtube, Graham_Stephan_channel_id)
Graham_Stephan_channel_data =pd.DataFrame(channel_statistics)
Graham_Stephan_channel_data
Channel_name | Subscribers | Views | Total_videos | |
---|---|---|---|---|
0 | Graham Stephan | 4610000 | 818870610 | 984 |
api_key = 'AIzaSyB24Kop04L1GlTgRCm1XtQ4KB2a4gaBOwA'
Loida_Velasquez_channel_id = ['UCpVj89CY-1kVucDpMmVFb3w' # Loida Velasquez
]
youtube = build('youtube','v3',developerKey = api_key)
from googleapiclient.errors import HttpError
def get_channel_stats(youtube,Loida_Velasquez_channel_id):
all_data = []
try:
request = youtube.channels().list(
part='snippet,contentDetails,statistics',
id=','.join(Loida_Velasquez_channel_id)
)
response = request.execute()
for item in response.get('items', []):
snippet = item.get('snippet', {})
statistics = item.get('statistics', {})
data = {
'Channel_name': snippet.get('title', ''),
'Subscribers': statistics.get('subscriberCount', ''),
'Views': statistics.get('viewCount', ''),
'Total_videos': statistics.get('videoCount', '')
}
all_data.append(data)
except HttpError as e:
print(f"HTTP error occurred: {e}")
print(f"Request URL: {e.resp.request.url}")
print(f"Request body: {e.resp.request.body}")
return all_data
get_channel_stats(youtube, Loida_Velasquez_channel_id)
[{'Channel_name': 'Loida Velasquez', 'Subscribers': '91300', 'Views': '5484625', 'Total_videos': '400'}]
channel_statistics = get_channel_stats(youtube, Loida_Velasquez_channel_id)
Loida_Velasquez_channel_data =pd.DataFrame(channel_statistics)
Loida_Velasquez_channel_data
Channel_name | Subscribers | Views | Total_videos | |
---|---|---|---|---|
0 | Loida Velasquez | 91300 | 5484625 | 400 |
# Combine DataFrames using concat
combined_real_estate_channels_df = pd.concat([
BiggerPockets_channel_data ,
Grant_Cardone_channel_data,
Phil_Pustejovsky_channel_data ,
Graham_Stephan_channel_data ,
Loida_Velasquez_channel_data,
], ignore_index=True)
# Display the result
print(combined_real_estate_channels_df)
Channel_name Subscribers Views Total_videos 0 BiggerPockets 1160000 104779284 3092 1 Grant Cardone 2510000 522294867 5944 2 Phil Pustejovsky 330000 118822902 286 3 Graham Stephan 4610000 818870610 984 4 Loida Velasquez 91300 5484625 400
# lets have a look at the datatypes
combined_real_estate_channels_df.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 5 entries, 0 to 4 Data columns (total 4 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Channel_name 5 non-null object 1 Subscribers 5 non-null object 2 Views 5 non-null object 3 Total_videos 5 non-null object dtypes: object(4) memory usage: 292.0+ bytes
# lets change the datatypes to perform visualisations
combined_real_estate_channels_df['Subscribers'] = pd.to_numeric(combined_real_estate_channels_df['Subscribers'])
combined_real_estate_channels_df['Views'] = pd.to_numeric(combined_real_estate_channels_df['Views'])
combined_real_estate_channels_df['Total_videos'] = pd.to_numeric(combined_real_estate_channels_df['Total_videos'])
# letsconirm if the datatypes has changed
combined_real_estate_channels_df.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 5 entries, 0 to 4 Data columns (total 4 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Channel_name 5 non-null object 1 Subscribers 5 non-null int64 2 Views 5 non-null int64 3 Total_videos 5 non-null int64 dtypes: int64(3), object(1) memory usage: 292.0+ bytes
combined_real_estate_channels_df
Channel_name | Subscribers | Views | Total_videos | |
---|---|---|---|---|
0 | BiggerPockets | 1160000 | 104779284 | 3092 |
1 | Grant Cardone | 2510000 | 522294867 | 5944 |
2 | Phil Pustejovsky | 330000 | 118822902 | 286 |
3 | Graham Stephan | 4610000 | 818870610 | 984 |
4 | Loida Velasquez | 91300 | 5484625 | 400 |
import matplotlib.pyplot as plt
# Sort the DataFrame by 'Subscribers' in descending order
combined_real_estate_channels_df_subscribers_sorted = combined_real_estate_channels_df.sort_values(by='Subscribers', ascending=False)
# Plotting Subscribers in descending order
fig, axes = plt.subplots(nrows=3, ncols=1, figsize=(10, 15))
axes[0].bar(combined_real_estate_channels_df_subscribers_sorted['Channel_name'], combined_real_estate_channels_df_subscribers_sorted['Subscribers'], color='blue')
axes[0].set_title('Subscribers')
# Sort the DataFrame by 'Views' in descendcombined_real_estate_channels_dfing order
combined_real_estate_channels_df_views_sorted = combined_real_estate_channels_df.sort_values(by='Views', ascending=False)
# Plotting Views in descending order
axes[1].bar(combined_real_estate_channels_df_views_sorted['Channel_name'], combined_real_estate_channels_df_views_sorted['Views'], color='green')
axes[1].set_title('Views')
# Sort the DataFrame by 'Total_videos' in descending order
combined_real_estate_channels_df_total_videos_sorted = combined_real_estate_channels_df.sort_values(by='Total_videos', ascending=False)
# Plotting Total Videos in descending order
axes[2].bar(combined_real_estate_channels_df_total_videos_sorted['Channel_name'], combined_real_estate_channels_df_total_videos_sorted['Total_videos'], color='orange')
axes[2].set_title('Total Videos')
# Adjust layout for better visibility
plt.tight_layout()
# Show the plot
plt.show()